import { defineStore } from 'pinia';
import { computed, ref } from 'vue';
export const useCounter = defineStore('other', () => {
  //定义数据
  const count = ref(0);
  //定义修改数据的方法（action 同步+异步）
  const increment = () => {
    count.value++;
  };
  const getList = () => {
    console.log('object');
    count.value * 5;
  };

  //getter定义
  const doubleCount = computed(() => count.value * 2);

  //以对象形式return供数组使用
  return {
    count,
    increment,
    doubleCount,
    getList,
  };
});
